<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>

		</view>
		<view>
			<u-button>默认按钮</u-button>
			<u-button type="primary">主要按钮</u-button>
			<u-button type="success">成功按钮</u-button>
			<u-button type="info">信息按钮</u-button>
			<u-button type="warning">警告按钮</u-button>
			<u-button type="error">危险按钮</u-button>
		</view>
		<button open-type="getUserInfo" @getuserinfo="getUserInfo">获取用户信息1</button>
		<view class="userInformation">
			<!-- 用户自定义头像 -->
			<view class="userPortrait">
				<image :src="yonghuwx.avatarUrl" mode="widthFix"></image>
			</view>
			<view class="userLook">
				<!-- 用户自定义名字 -->
				<view class="user-title clamp">{{yonghuwx.nickName}}</view>
				<view class="user-edit">查看个人资料</view>
			</view>
		</view>

		<u-tabbar class='mb-20' :value="current" @change='onChange' :list="list"></u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				list: [{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						count: 2,
						isDot: true,
						customIcon: false,
					},
					{
						iconPath: "photo",
						selectedIconPath: "photo-fill",
						text: '放映厅',
						customIcon: false,
					},
					{
						iconPath: "chat",
						selectedIconPath: "chat-fill",
						text: '聊天',

						customIcon: false,
					},
					{
						iconPath: "play-right",
						selectedIconPath: "play-right-fill",
						text: '直播',
						customIcon: false,
					},
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',
						count: 23,
						isDot: false,
						customIcon: false,
					},
				],
				current: 0,
				yonghuwx: {}
			}
		},
		onLoad() {
			let that = this;
			uni.login({
				provider:'weixin',
				success:function(loginRes) {
				// 获取用户信息
				    uni.getUserInfo({
					    provider:'weixin',
						success:function(infoRes){
					   	    that.yonghuwx = infoRes.userInfo
					    	console.log(that.yonghuwx)
						}
					});
				}
			});
		},
		methods: {
			onChange(e) {
				if (e == 2) {
					this.current = 0
					uni.switchTab({
						url: "/pages/message/index"
					})
				}
			},
			getUserInfo(e){
				console.log(e,'e')
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.mb-20 /deep/ .u-tabbar__content {
		margin-bottom: 10px !important;
	}
</style>
